/**
 * @Author Yenchingcheng
 * @Date 2023/5/28 21:42
 * @Description 水果工厂类：水果    
 **/
public class FruitFactory {

    public static Fruit getFruit(String fruitType){
        if(fruitType == null){
            return null;
        }
        if(fruitType.equalsIgnoreCase("apple")){
            return new Apple();
        }else if(fruitType.equalsIgnoreCase("pear")){
            return new Pear();
        }else if(fruitType.equalsIgnoreCase("orange")){
            return new Orange();
        }
        return null;
    }
}
